﻿<UserControl x:Class="TfsBuildManager.Views.ProcessTemplatesGrid"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:Controls="clr-namespace:TfsBuildManager.Controls;assembly=TFSBuildManager.Controls" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="600">
  <UserControl.Resources>
    <ResourceDictionary Source="/TFSBuildManager.Views;component/Themes/ResourceDictionary.xaml"/>
  </UserControl.Resources>  
    <Grid>
        <Grid.Resources>
            <Style TargetType="{x:Type GridViewColumnHeader}">
                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                <Setter Property="Margin" Value="5,0,0,0"/>
            </Style>
        </Grid.Resources>

    <Controls:SortableListView BorderThickness="0,0,0,0" x:Name="ProcessTemplateList" ItemsSource="{Binding BuildProcessTemplatess}" Margin="0,-1,0,1" Style="{StaticResource ResourceKey=ListViewStyle}">
            <ListView.Resources>
                <DataTemplate x:Key="NameTemplate">
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                        <TextBlock Text="{Binding ServerPath}" Margin="3,0,0,1" VerticalAlignment="Bottom"/>
                    </StackPanel>
                </DataTemplate>
                <DataTemplate x:Key="TeamProjectTemplate">
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                        <TextBlock Text="{Binding TeamProject}" Margin="3,0,0,1" VerticalAlignment="Bottom"/>
                    </StackPanel>
                </DataTemplate>
                <DataTemplate x:Key="TypeTemplate">
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                        <TextBlock Text="{Binding TemplateType}" Margin="3,0,0,1" VerticalAlignment="Bottom"/>
                    </StackPanel>
                </DataTemplate>                
                <Style TargetType="{x:Type GridViewColumnHeader}">
                    <Setter Property="Margin" Value="0,0,0,0" />
                    <Setter Property="HorizontalContentAlignment" Value="Left" />
                </Style>
            </ListView.Resources>

            <ListView.View>
                <GridView>
                    <Controls:SortableGridViewColumn Header="Path" SortPropertyName="ServerPath" IsDefaultSortColumn="True" CellTemplate="{StaticResource NameTemplate}"/>
                    <Controls:SortableGridViewColumn Header="Team Project" SortPropertyName="TeamProject" IsDefaultSortColumn="False" CellTemplate="{StaticResource TeamProjectTemplate}"/>
                    <Controls:SortableGridViewColumn Header="Type" SortPropertyName="TemplateType" IsDefaultSortColumn="False" CellTemplate="{StaticResource TypeTemplate}"/>
                </GridView>
            </ListView.View>
        </Controls:SortableListView>
    </Grid>
</UserControl>
